<table id="sample-table-1" class="table table-striped table-bordered table-hover"
       xmlns:th="http://www.thymeleaf.org/">
    <thead>
    <tr>
        <th class="center">序 号</th>
        <th class="left">商品名称</th>
        <th class="left">商品图片</th>
        <th class="center">价 格</th>
        <th class="center">分 成</th>
        <th class="center">
            <i class="icon-time bigger-110 hidden-480"></i>
            加入时间
        </th>
        <th class="center">推荐</th>
        <th class="center">置顶</th>
        <th class="center">状态</th>

        <th class="left">操 作</th>
    </tr>
    </thead>

    <tbody>



    <tr th:each="goods,data:${goodList}">
        <td class="center" th:text="${data.count}">
            1
        </td>

        <td class="left"><a href="#" onclick="window.location.href='/fxmall/cust/goods/add?good_id=14886110'" th:text="${goods.goodName}">asdadsa</a></td>
        <td class="left"><img style="width: 50px;height: 50px;" th:src="@{${goods.goodPic}}"></td>
        <td class="center" th:text="${goods.goodId}">1|</td>
        <td class="center">1|</td>
        <td class="center">2016-05-21 19:30:17</td>

        <td class="center">
            <span class="label label-sm label-primary">未置顶</span>
        </td>


        <td class="center">
            <span class="label label-sm label-success">已推荐</span>
        </td>

        <td class="center">
            <span class="label label-sm label-success">审核有效</span>
        </td>

        <td class="left">
            <div class="visible-md visible-lg hidden-sm hidden-xs btn-group" style="align:center">
                <button class="btn btn-xs btn-primary" th:onclick="updateState([[${goods.goodId}]],1)">
                    <i class="icon-edit bigger-120">上架</i>
                </button>

                <button class="btn btn-xs btn-danger" th:onclick="updateState([[${goods.goodId}]],0)">
                    <i class="icon-trash bigger-120">下架</i>
                </button>
            </div>
        </td>
    </tr>



    </tbody>

</table>

<script>
    function updateState(goodId,state) {
        $.post("good/update",{state:state,goodId:goodId},function (data) {
            if (data.code == 1) {
                alert("已上架");
            } else {
                alert("上架失败");
            }
        });
    }
</script>
